import EditorArea from "./EditorArea/index.vue";
import RenderByJson from "./RenderByJson/index.vue";
import TagArea from "./TagArea/index.vue";
import AbsoluteArea from "./AbsoluteArea/index.vue"

import {deepAssign} from "dlsjs"

import {getProperty, getTags, getUsage} from "./common/getConfig.js"

const component = {
  EditorArea,
  RenderByJson,
  TagArea,
  AbsoluteArea
}

const createNovue = function (options = {}) {
  return {
    extendCfg: {},
    install(App) {
      window.$novue_config = deepAssign(this.extendCfg, options)
      for (let key in component) {
        App.component(key, component[key]);
      }
    },
    use(cfg) {
      deepAssign(this.extendCfg, cfg)
    }
  }
}

export {createNovue, getProperty, getTags, getUsage}
